package org.grayrabbit.cms.entity;

// Generated 2011-5-16 13:39:30 by Hibernate Tools 3.3.0.GA

import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.grayrabbit.cms.tree.TreeNode;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Where;


/**
 * CmsSite generated by hbm2java
 */
@Entity
@Table(name = "CMS_SITE")
public class Site implements java.io.Serializable ,TreeNode{

	private static final long serialVersionUID = 4063227756505571649L;
	private String siteId;
	private String siteName;
	private String siteShortName;
	private String siteDomain;
	private String siteRootPath;
	private Boolean siteStatus;
	private String siteTheme;
	private String siteType;
	private String siteIp;
	private String siteLoginName;
	private String siteLoginPassword;
	private String siteSecondDomain;
	private Boolean siteVirtualHosting;
	private Date createTime;
	private String createLoginName;
	private String createRealName;
	private Date updateTime;
	private String updateLoginName;
	private String updateRealName;
	private String siteIndexTpl;
	private String area;
	private String logo;
	private Set<Category> categories = new HashSet<Category>(0);
	private Set<Topic> topics = new HashSet<Topic>(0);

	//二期
	private String smallPictureSize; //小图片大小
	private String middlePictureSize;//中图片大小
	private String bigPictureSize;//大图片大小
	private String picType;//图片类型
	private String cartoonType;//动画类型
	private String videoType;//视频类型
	private String softWareType;//软件类型
	private Long pictureAdvice;//图片大小限制
	private Long cartoonAdvice;//动画大小限制
	private Long videoAdvice;//视频大小限制
	private Long softwareAdvice;//软件大小限制
	private String banner;//banner路径
	private String copyright;//版权所有
	private String address;//地址
	private String postalCode;//邮政编码
	private String recordNumber;//备案号
	private String technicalSupport;//技术支持
	private String adminEmail;//管理员邮箱
	
	//end
	
	
	public Site() {
	}

	public Site(String siteId) {
		this.siteId = siteId;
	}

	@Id
	@Column(name = "SITE_ID", unique = true, nullable = false, length = 32)
	@GeneratedValue(generator = "paymentableGenerator")       
	@GenericGenerator(name = "paymentableGenerator", strategy = "uuid") 
	public String getSiteId() {
		return this.siteId;
	}

	public void setSiteId(String siteId) {
		this.siteId = siteId;
	}

	@Column(name = "SITE_NAME", length = 64)
	public String getSiteName() {
		return this.siteName;
	}

	public void setSiteName(String siteName) {
		this.siteName = siteName;
	}

	@Column(name = "SITE_SHORT_NAME", length = 32)
	public String getSiteShortName() {
		return this.siteShortName;
	}

	public void setSiteShortName(String siteShortName) {
		this.siteShortName = siteShortName;
	}

	@Column(name = "SITE_DOMAIN", length = 256)
	public String getSiteDomain() {
		return this.siteDomain;
	}

	public void setSiteDomain(String siteDomain) {
		this.siteDomain = siteDomain;
	}

	@Column(name = "SITE_ROOT_PATH", length = 256)
	public String getSiteRootPath() {
		return this.siteRootPath;
	}

	public void setSiteRootPath(String siteRootPath) {
		this.siteRootPath = siteRootPath;
	}

	@Column(name = "SITE_STATUS", precision = 1, scale = 0)
	public Boolean getSiteStatus() {
		return this.siteStatus;
	}

	public void setSiteStatus(Boolean siteStatus) {
		this.siteStatus = siteStatus;
	}

	@Column(name = "SITE_THEME", length = 32)
	public String getSiteTheme() {
		return this.siteTheme;
	}

	public void setSiteTheme(String siteTheme) {
		this.siteTheme = siteTheme;
	}

	@Column(name = "SITE_TYPE", length = 32)
	public String getSiteType() {
		return this.siteType;
	}

	public void setSiteType(String siteType) {
		this.siteType = siteType;
	}

	@Column(name = "SITE_IP", length = 64)
	public String getSiteIp() {
		return this.siteIp;
	}

	public void setSiteIp(String siteIp) {
		this.siteIp = siteIp;
	}

	@Column(name = "SITE_LOGIN_NAME", length = 64)
	public String getSiteLoginName() {
		return this.siteLoginName;
	}

	public void setSiteLoginName(String siteLoginName) {
		this.siteLoginName = siteLoginName;
	}

	@Column(name = "SITE_LOGIN_PASSWORD", length = 64)
	public String getSiteLoginPassword() {
		return this.siteLoginPassword;
	}

	public void setSiteLoginPassword(String siteLoginPassword) {
		this.siteLoginPassword = siteLoginPassword;
	}

	@Column(name = "SITE_SECOND_DOMAIN", length = 256)
	public String getSiteSecondDomain() {
		return this.siteSecondDomain;
	}

	public void setSiteSecondDomain(String siteSecondDomain) {
		this.siteSecondDomain = siteSecondDomain;
	}

	@Column(name = "SITE_VIRTUAL_HOSTING", precision = 1, scale = 0)
	public Boolean getSiteVirtualHosting() {
		return this.siteVirtualHosting;
	}

	public void setSiteVirtualHosting(Boolean siteVirtualHosting) {
		this.siteVirtualHosting = siteVirtualHosting;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "CREATE_TIME", length = 7)
	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name = "CREATE_LOGIN_NAME", length = 64)
	public String getCreateLoginName() {
		return this.createLoginName;
	}

	public void setCreateLoginName(String createLoginName) {
		this.createLoginName = createLoginName;
	}

	@Column(name = "CREATE_REAL_NAME", length = 64)
	public String getCreateRealName() {
		return this.createRealName;
	}

	public void setCreateRealName(String createRealName) {
		this.createRealName = createRealName;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "UPDATE_TIME", length = 7)
	public Date getUpdateTime() {
		return this.updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	@Column(name = "UPDATE_LOGIN_NAME", length = 64)
	public String getUpdateLoginName() {
		return this.updateLoginName;
	}

	public void setUpdateLoginName(String updateLoginName) {
		this.updateLoginName = updateLoginName;
	}

	@Column(name = "UPDATE_REAL_NAME", length = 64)
	public String getUpdateRealName() {
		return this.updateRealName;
	}

	public void setUpdateRealName(String updateRealName) {
		this.updateRealName = updateRealName;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "site")
	@Where(clause="parent_id is null")
	@org.hibernate.annotations.OrderBy(clause="ord asc,cat_name asc")
	public Set<Category> getCategories() {
		return this.categories;
	}

	public void setCategories(Set<Category> categories) {
		this.categories = categories;
	}
	public void add(Category cat){
		if(categories==null){
			categories = new HashSet<Category>();
		}
		categories.add(cat);
	}
	
	public void add(Collection<Category> c){
		if(categories==null){
			categories = new HashSet<Category>();
		}
		categories.addAll(c);
	}
	
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "site")
	@org.hibernate.annotations.OrderBy(clause="topic_name asc")
	public Set<Topic> getTopics() {
		return this.topics;
	}

	public void setTopics(Set<Topic> topics) {
		this.topics = topics;
	}
	
	@Transient
	public String getTreeNodeId() {
		return siteId+"_tree";
	}

	@Transient
	public String getTreeNodeName() {
		return "<a href='category-list.action' target='mainframe'>"+siteName+"</a>";
	}

	@Transient
	public String getTreeNodeNameDoc() {
		return siteName;
	}

	@Transient
	public String getTreeNodeNameBox() {
		return siteName;
	}
	@Override
	public boolean equals(Object obj) {
		if(this==obj) 
			return true;
		if(!(obj instanceof Site))
			return false;
		final Site site = (Site) obj;
		if(siteId!=null && site.getSiteId()!=null){
			if(site.getSiteId().equals(this.siteId))
				return true;
		}
		return false;
	}

	@Transient
	public String getTreeNodeNameRadio() {
		return siteName;
	}
	
	@Column(name = "SITE_INDEX_TPL", length = 256)
	public String getSiteIndexTpl() {
		return siteIndexTpl;
	}

	public void setSiteIndexTpl(String siteIndexTpl) {
		this.siteIndexTpl = siteIndexTpl;
	}
	@Column(name = "AREA", length = 32)
	public String getArea() {
		return area;
	}

	public void setArea(String area) {
		this.area = area;
	}
	
	@Column(name = "LOGO", length = 256)
	public String getLogo() {
		return logo;
	}

	public void setLogo(String logo) {
		this.logo = logo;
	}
	@Column(name = "SMALL_PICTURE_SIZE", length = 64)
	public String getSmallPictureSize() {
		return smallPictureSize;
	}

	public void setSmallPictureSize(String smallPictureSize) {
		this.smallPictureSize = smallPictureSize;
	}
	@Column(name = "MIDDLE_PICTURE_SIZE", length = 64)
	public String getMiddlePictureSize() {
		return middlePictureSize;
	}

	public void setMiddlePictureSize(String middlePictureSize) {
		this.middlePictureSize = middlePictureSize;
	}
	@Column(name = "BIG_PICTURE_SIZE", length = 64)
	public String getBigPictureSize() {
		return bigPictureSize;
	}

	public void setBigPictureSize(String bigPictureSize) {
		this.bigPictureSize = bigPictureSize;
	}
	@Column(name = "PIC_TYPE", length = 64)
	public String getPicType() {
		return picType;
	}

	public void setPicType(String picType) {
		this.picType = picType;
	}
	@Column(name = "CARTOON_TYPE", length = 64)
	public String getCartoonType() {
		return cartoonType;
	}

	public void setCartoonType(String cartoonType) {
		this.cartoonType = cartoonType;
	}
	@Column(name = "VIDEO_TYPE", length = 64)
	public String getVideoType() {
		return videoType;
	}

	public void setVideoType(String videoType) {
		this.videoType = videoType;
	}
	@Column(name = "SOFTWARE_TYPE", length = 64)
	public String getSoftWareType() {
		return softWareType;
	}

	public void setSoftWareType(String softWareType) {
		this.softWareType = softWareType;
	}
	@Column(name = "PICTURE_ADVICE", precision = 11, scale = 0)  
	public Long getPictureAdvice() {
		return pictureAdvice;
	}

	public void setPictureAdvice(Long pictureAdvice) {
		this.pictureAdvice = pictureAdvice;
	}
	@Column(name = "CARTOON_ADVICE", precision = 11, scale = 0)
	public Long getCartoonAdvice() {
		return cartoonAdvice;
	}

	public void setCartoonAdvice(Long cartoonAdvice) {
		this.cartoonAdvice = cartoonAdvice;
	}
	@Column(name = "VIDEO_ADVICE", precision = 11, scale = 0)
	public Long getVideoAdvice() {
		return videoAdvice;
	}

	public void setVideoAdvice(Long videoAdvice) {
		this.videoAdvice = videoAdvice;
	}
	@Column(name = "SOFTWARE_ADVICE", precision = 11, scale = 0)
	public Long getSoftwareAdvice() {
		return softwareAdvice;
	}

	public void setSoftwareAdvice(Long softwareAdvice) {
		this.softwareAdvice = softwareAdvice;
	}

	@Column(name = "BANNER", length = 256)
	public String getBanner() {
		return banner;
	}

	public void setBanner(String banner) {
		this.banner = banner;
	}

	@Column(name = "COPYRIGHT", length = 64)
	public String getCopyright() {
		return copyright;
	}

	public void setCopyright(String copyright) {
		this.copyright = copyright;
	}

	
	@Column(name = "ADDRESS", length = 256)
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "POSTALCODE", length = 32)
	public String getPostalCode() {
		return postalCode;
	}

	public void setPostalCode(String postalCode) {
		this.postalCode = postalCode;
	}

	@Column(name = "RECORD_NUMBER", length = 32)
	public String getRecordNumber() {
		return recordNumber;
	}

	public void setRecordNumber(String recordNumber) {
		this.recordNumber = recordNumber;
	}
	
	@Column(name = "TECHNICAL_SUPPORT", length = 32)
	public String getTechnicalSupport() {
		return technicalSupport;
	}

	public void setTechnicalSupport(String technicalSupport) {
		this.technicalSupport = technicalSupport;
	}

	@Column(name = "ADMIN_EMAIL", length = 64)
	public String getAdminEmail() {
		return adminEmail;
	}

	public void setAdminEmail(String adminEmail) {
		this.adminEmail = adminEmail;
	}
	

}
